package com.zb.servlet;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSON;
import com.zb.entity.Msi;
import com.zb.service.MsiService;
import com.zb.service.impl.MsiServiceImpl;

/**
 * Servlet implementation class choose
 */
public class choose extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private MsiService msi=new MsiServiceImpl();
    


	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		this.doPost(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		// TODO Auto-generated method stub
		response.setContentType("text/html;charset=UTF-8");
		request.setCharacterEncoding("UTF-8");
		PrintWriter out=response.getWriter();
		List<Msi>m=msi.getAllList();
		String str=JSON.toJSONString(m);
		out.print(str);
		out.flush();
		out.close();
	}

}
